package pack423;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class RendTest {
    public static void main(String[] args) {
        FileReader fr = null;
        StringBuffer buffer = new StringBuffer();
            try {
                fr = new FileReader("D:/test.txt");
                char[] charBuffer = new char[1024];
                int count = fr.read(charBuffer);
                while (count>0) {
                    buffer.append(charBuffer, 0, count);
                    count = fr.read(charBuffer);
                }
                System.out.println(buffer.toString());
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }finally {
                if(fr != null){
                    try {
                        fr.close();
                        fr=null;
                    } catch (IOException e) {
                        e.printStackTrace();
                    }

                }
    }
    }
}
